module.exports = {
  updateMediaService: 'update tb_media set service_num=service_num+1 where writer_id=? and status=1',
  updateAccountMoney: 'update tb_wechat_writer set total_money=total_money+? where id=?',
  queryByOutTradeNo: 'select openid,get_user_id,total_fee,forecast_id from tb_wechat_praise_record where out_trade_no=?',
  updateTransaction: 'UPDATE tb_wechat_praise_record set bank_type=?,cash_fee=?,is_subscribe=?,transaction_id=?,status=? where out_trade_no=?',
// 用户注册
  insertBaseUserInfointoWriter: `insert into tb_wechat_writer set wechat_openid=?`,
  insertUserInfointoWriter: `insert into tb_wechat_writer set wechat_openid=?, nickName=?, gender=?, province=?, city=?, country=?, avatarUrl=?, app_image=?`,
// 判断用户是否在用户表里面注册了
  isUserInfoSaveinWriter: 'select id from tb_wechat_writer where wechat_openid=?',
// 从支付列表里面获取支付记录
  isUserPayForecast: 'select pay_user_id from tb_wechat_praise_record where forecast_id=? and pay_user_id=? and status=1',
// 预测日志
  createForecastLog: 'insert into tb_forecast_log set user_writer_id=?,media_id=?,forecast_id=?',
  insertTransactionandforecastId: 'insert into tb_wechat_praise_record set forecast_id=?, out_trade_no=?, openid=?, tax_fee=?, total_fee=?, pay_user_id=?,get_user_id=?, status=?,prepayid=?',
// 获取预测的详细数据和具体命中率数据
  getForecastAndRate: `select b.rate_name,b.rate_en_name,b.order,c.rate_score from 
tb_forecast as a,tb_lottery_rate_dic as b,tb_hit_rate as c
where a.id=? and a.status=1 and a.media_id=c.media_id and 
a.lottery_id=b.lottery_type and b.id=c.rate_id order by b.order`,
// 获取预测列表
  getForecastListOption: `select ta.*,tb.media_image,tb.hit_rate,tb.service_num from
tb_forecast as ta ,tb_media as tb where ta.status=1 and ta.create_time>? and 
ta.media_id=tb.id ORDER BY create_time desc `,
// 获取制定预测列表
  getForecastTop: `select ta.*,tb.media_image,tb.hit_rate,tb.service_num from
tb_forecast as ta ,tb_media as tb where ta.is_top=1 and ta.status=1 and ta.create_time>? and 
ta.media_id=tb.id ORDER BY create_time desc `,
// 获取最新媒体信息
  getMediaInfoBymediaId: 'select * from tb_media where id=? and status!=0 order by create_time DESC',
// 获取根据预测id获取预测信息
  getForecastInfo: 'select * from tb_forecast where id=? and status=1',
// 获取媒体作者的预测列表
  getForecastListByMediaId: 'select * from tb_forecast where  media_id=? and create_time<? and status=1 limit 0,50',
  updateForecastRecognizedNum: 'update tb_forecast set recognized_num=recognized_num+1 where status=1 and id=?',
// 更新媒体信息
  updateForecastRead: 'update tb_forecast set read_num=read_num+1 where status=1 and id=?'
}
